
package nav;

import java.util.Collection;
import java.util.HashMap;

public class StreetCollectionImpl implements StreetCollection {
	
	private HashMap<String, Street> streets;
    
	public StreetCollectionImpl(){
		streets = new HashMap<String, Street>();
    }

	@Override
	public void addStreet(Street street) {
		streets.put(street.getID(), street);
	}

	@Override
	public boolean streetExists(String id) {
		return streets.containsKey(id);
	}

	@Override
	public Street getStreet(String id) {
		return streets.get(id);
	}

	@Override
	public void removeStreet(Street street) {
		streets.remove(street.getID());
	}

	@Override
	public Collection<Street> getAllStreets() {
		return streets.values();
	}

	@Override
	public void clear() {
		streets.clear();
	}  
}
